<?

require_once ("application.list.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;
global $_IFACE_CONTROL_OBJECT;
global $_SET_TABBING;

$fs_local_document = $_SERVER["PHP_SELF"];

$lc_inv_ctl_suppliers = array (
	name=>array (label=>"Company Name",alias=>"inv_ctl_suppliers.name",order=>"DEFAULT",wrapper=>"vmc_icon_supplier"),
	contact=>array (label=>"Contact Name",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
	city=>array (label=>"City",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
	country=>array (label=>"Country",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
	phone_1=>array (label=>"Phone 1",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
	cdate=>array (label=>"Create Date",order=>"DEFAULT",wrapper=>"vmc_icon_date"),
);

$link_options_path = array (
	array (
		fs_tab=>"inv_ctl_suppliers",
		fs_tab_option=>"lc_inv_ctl_suppliers",
	)
);

$link_options = _app_create_tabbing (null, $link_options_path);

$object_ctl_path = array (
	array (
		fs_action=>"view",
		fs_tab=>"inv_ctl_suppliers",
		fs_tab_option=>"fs_inv_ctl_suppliers"
	)
);

$object_ctl = _app_create_tabbing ( "{$fs_local_document}?",
		$object_ctl_path) . "&";

$list_options_path = array (
	array (
		fs_tab=>"inv_ctl_suppliers",
		fs_action=>"addnew",
		fs_tab_option=>"fs_inv_ctl_suppliers"
	)
);
		
$list_options = array (
	array (
		label=>"Add A Supplier",
		link=>_app_create_tabbing ("{$fs_local_document}?",$list_options_path)
	),
);

$_OBJECT_IFACE_LIST = _app_create_list_object (array (
                db_conn=>$_GLOBAL_DBH,
                indexes=>$lc_inv_ctl_suppliers,
		list_count=>"SELECT COUNT(*) FROM inv_ctl_suppliers",
		list_select=>"SELECT inv_ctl_suppliers.id,inv_ctl_suppliers.name,contact,city,phone_1,cdate,acc_ctl_countries.name as country  FROM inv_ctl_suppliers, acc_ctl_countries where country_id=acc_ctl_countries.id",
                list_id=>"lc_inv_ctl_suppliers",
                list_options=>$list_options,
                primary_key=>"id",
                primary_relation=>"supplier_id",
                link_options=>$link_options,
                object_ctl=>$object_ctl
));


if (($_REQUEST["fs_tab"] == "inv_ctl_suppliers") &&
		($_REQUEST["fs_tab_option"] == "fs_inv_ctl_suppliers") &&
		($_REQUEST["supplier_id"] > 0))
	$_SET_TABBING = true;

array_push ($_IFACE_CONTROL_OBJECT, $_OBJECT_IFACE_LIST);

?>
